package com.pi.tcp.hook;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.EventLoopGroup;

/**
 * @author chenmfa
 * @date 创建时间: 2017-5-5 上午10:23:42
 * @description
 */
public class ShutDownHook implements Runnable{
  
  private static final Logger logger= LoggerFactory.getLogger(ShutDownHook.class);
  private ServerBootstrap bootStrap;
  public ShutDownHook(ServerBootstrap bootStrap){
    this.bootStrap = bootStrap;
  }
  @Override
  public void run() {
    if(null != bootStrap){
      EventLoopGroup group = bootStrap.group();
      group.shutdownGracefully();
    }
  }
}
